'''
    定义字符串变量
        字符串变量= "字符串.."
        字符串变量= '字符串...'

    他说:"python很简单"

    *长度 len(字符串变量)
    *每个字符都有下标 下表从0开始
    *切片操作
        变量[起始位置:结束位置:步长]
'''

str1 = "他说:'python很简单'"
str2 = '他说:"java很简单"'
str3 = '''
123ewqqqqqqqqqq
qweeeeeee
'''

print(len(str1))
print(len(str2))
print(len(str3))
print(str2[6],str2[7])

print(str1[1:10:])
print(str1[0:len(str1):2])
print(str1[::2])
print(str1[:3:])
print(str1[3::])
print(str1[::-1])

# 查找字符串
# find index count
print(str1.find("python"))# 存在返回下表
print(str1.find("python1"))#不存在返回 -1
print(str1.index("python"))
# print(str1.index("python1"))
print(str3.count("q"))

# replace
str4 = "祖国大好河山，人人爱！"

str5 = str4.replace("河山","山河")
print(str4)
print(str5)


#splite 分割
str6 = "小黄，小白，小黑"
names = str6.split("，")
print(names)

#
print(str4.startswith("祖国"))
print(str4.endswith("人人爱！"))

keyword = " qianbi  bi  "
print(keyword.strip())
print(keyword.lstrip())
print(keyword.rstrip())
print(keyword.replace(" ",""))
astr = "阿斯顿"
print(astr.isalpha())
print(astr.isdigit())
print(astr.isalnum())



